<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<script type="text/javascript" src="/static/admin/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="/static/admin/js/rem.js"></script>
	<link rel="stylesheet" href="/static/admin/css/index.css" />
	<link rel="stylesheet" href="/static/admin/css/icon/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="/static/admin/css/cars.css"/>
	<title>查询停车费</title>
</head>
<style>
	.carui-order-detail-top-box{
		margin-top:14px;
	}
	.carui-order-detail-top-deal-status{
		margin-top:14px;
		margin-bottom:20px;
	}
</style>
<body>
		<div class="car_content">
	        <div class="car_mpecot">
				<ul class="mui-table-view mui-table-view-chevron">
					<li class="car-mui-table-view-cell-aft carui-stop-detail-li-clear-padding">
						
						<div class="carui-order-detail-top-money">{$orderinfo.amountDue/100}&nbsp;元</div>
						
						<div class="carui-order-detail-top-deal-status">停车信息</div>
						<div class="car_mpecotTBottom">
							
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">停车位置</span>
								<span class="car_mpecotTR">{$parkinginfo.parkingName}</span>
							</div>
						
						
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">车牌号</span>
								<span class="car_mpecotTR">{$orderinfo.carPlateNo}</span>
							</div>
							
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">入场时间</span>
								<span class="car_mpecotTR">{$orderinfo.parkingStartTime|strtotime|date="Y-m-d H:i:s"}</span>
							</div>
						
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">停车时长</span>
								<span class="car_mpecotTR">{$orderinfo.parkingTime|ctime}</span>
							</div>
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">应收金额</span>
								<span class="car_mpecotTR">{$orderinfo.amountDue/100}&nbsp;元</span>
							</div>
							<div class="carui-order-detail-text-box">
								<span class="car_mpecotTL">实收金额</span>
								<span class="car_mpecotTR">{$orderinfo.amountRec/100}&nbsp;元</span>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	<div class="footer">
		<p style="text-align:center"><i class="iconfont layui-extend-gantanhao"></i>请于付款后15分钟内离场，超时将加收停车费</p>
		<span onclick="createOrder('{$pay_id}')"><button style="background-color:#22ac38">立即付款</button></span>
	</div>
	
	
	
<script type="application/javascript">
	function createOrder(pay_id){
		var url = '{:url("createOrder")}'
		$.post(url, {pay_id: pay_id}, function(r){
			//return
			if (r.jsApiParameters) {
				jsApiCall(r.jsApiParameters)
			}else{
				alert(r.info)
				//location.reload()
			   
			}
		})
	}

    function jsApiCall(jsApiParameters){
		var jsApiParameters = eval('(' + jsApiParameters + ')');
		// console.log(jsApiParameters);
		WeixinJSBridge.invoke(
				'getBrandWCPayRequest',{
				"appId":jsApiParameters['appId'],//公众号名称，由商户传入
				"timeStamp":jsApiParameters['timeStamp'],//时间戳，自1970年以来的秒数
				"nonceStr":jsApiParameters['nonceStr'], //随机串
				"package":jsApiParameters['package'],//预支付交易会话标识
				"signType":jsApiParameters['signType'],//微信签名方式：
				"paySign":jsApiParameters['paySign']//微信签名
			},
			//上面参数一定要按照一定的顺序排列，否则会出错（签名验证失败）
			function(res) {
				//前端接收到支付结果通知，get_brand_wcpay_request:ok，支付成功
				//（但是不一定就是真的成功了，一切以回调地址中的结果为准，前端接收到支付通知后只做跳转，不做任何处理）
				//商户订单处理（更新用户账号余额）要放在回调地址中处理
				if(res.err_msg == "get_brand_wcpay_request:ok" ){
					 var url = "{:url('admin/order/wxok')}";
					window.location.href=url;
					
				}
			}
		);
	}
	function delay(){
		if (typeof WeixinJSBridge == "undefined"){
			if( document.addEventListener ){
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			}else if (document.attachEvent){
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		}else{
			onBridgeReady();
		}
	}
</script>
</body>

</html>